/**
 * @name 用户api
 */
// import type { AxiosResponse } from "axios";
import request from "@/utils/request.ts";

/**
 * 用户登录
 * @param data
 */
export function reqUserLogin(data: { username: string; password: string }) {
  return request({
    url: "/user/login",
    method: "post",
    data
  });
}

/**
 * 用户登出
 * @returns
 */
export function reqUserLogout() {
  return request({
    url: "/user/logout",
    method: "post"
  });
}

/**
 * 用户注册
 * @param data
 */
export function reqUserRegister(data: { username: string; password: string }) {
  return request({
    url: "/user/register",
    method: "post",
    data
  });
}

/**
 * 重置密码
 * @param data
 */
export function reqUserResetPassword(data: { username: string; password: string }) {
  return request({
    url: "/user/resetPassword",
    method: "patch",
    data
  });
}

/**
 * 刷新token
 */
export function reqRefreshToken(options: any) {
  return request({
    url: "/refresh/token",
    method: "post",
    ...options
  });
}
